package com.appkubes.mall.restful.application.goods.rent.service.impl;

import com.appkubes.mall.core.entity.MallGoodsRent;
import com.appkubes.mall.core.service.impl.BaseMallGoodsRentServiceImpl;
import com.appkubes.mall.restful.application.goods.goods.entity.dto.MallGoodsRentDTO;
import com.appkubes.mall.restful.application.goods.goods.entity.vo.MallCategoryVo;
import com.appkubes.mall.restful.application.goods.rent.dao.GoodsRentDao;
import com.appkubes.mall.restful.application.goods.rent.service.GoodsRentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsRentServiceImpl extends BaseMallGoodsRentServiceImpl implements GoodsRentService {
    @Autowired
    GoodsRentDao goodsRentDao;

    @Override
    public List<MallGoodsRentDTO> selectGoods(MallCategoryVo mallCategoryVo) {
        return goodsRentDao.selectGoods(mallCategoryVo.getCategoryKey(), mallCategoryVo.getAppKey());
    }

    @Override
    public MallGoodsRent findByKey(String key) {
        MallGoodsRent queryEntity = new MallGoodsRent();
        queryEntity.setGoodsKey(key);
        List<MallGoodsRent> mallGoodsRentList = this.selectListByEntity(queryEntity);
        if (mallGoodsRentList.size() == 0) return null;
        return mallGoodsRentList.get(0);
    }
}

